﻿@{
    ViewBag.Title = "推送用户管理";
}
@section headerSection{
    <style>
        #exampleToolbar > .form-group {
            float: left;
            margin: 0;
            margin-left: 5px;
        }

        #exampleToolbar > .form-group {
            float: left;
            margin: 0;
            margin-right: 5px;
            margin-top: 1px;
        }

        .form-group > button {
            margin-top: -2px;
            margin-bottom: 2px;
        }
    </style>
}
<div class="animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins" style="margin-bottom: 0px;">
        <div class="ibox-content" style="padding: 5px 20px 0px 20px;">
            <div class="row row-lg">
                <div class="col-sm-12 col-sm-leftRight">
                    <!-- Example Toolbar -->
                    <div class="example">
                        <div class="btn-group hidden-xs" id="exampleToolbar" role="group">
                            <div class="form-group" style="margin-left:0;width:160px;margin-top:-1px;">
                                <select id="messType" name="messType" title="请选择消息类别" data-live-search="true" class="form-control show-tick selectpicker" placeholder="请选择消息类别">
                                    <option value="" selected>全部</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <input id="messNote" name="messNote" type="text" class="form-control" placeholder="消息内容">
                            </div>
                            <div class="form-group">
                                <input id="keyword" name="keyword" type="text" class="form-control" placeholder="用户名/手机号">
                            </div>
                            <div class="form-group">
                                <input id="messId" name="messId" type="text" class="form-control" onblur="help.int('messId')" onkeyup="help.int('messId')" placeholder="消息id：整数类型">
                            </div>
                            <div class="form-group">
                                <button id="btnSearch" class="btn btn-primary" type="button"><i class="fa fa-search"></i>&nbsp;查询</button>
                            </div>
                        </div>
                        <table id="exampleTableToolbar" data-mobile-responsive="true" data-radio="true"></table>
                    </div>
                    <!-- End Example Toolbar -->
                </div>
            </div>
        </div>
    </div>
    <!-- End Panel Other -->
</div>
@section footSection{
    <script>
        var options, $table;
        var messUserManager = {
            initPage: function () {
                messUserManager.initSelect();
                messUserManager.initTable();
                messUserManager.bindEvent();
            },
            //初始化下拉
            initSelect: function () {
                $('#messType').initSelectcontrol("UserMessageType", true);
            },
            //初始化Table
            initTable: function () {
                options = {
                    url: ctx + "/VRSearchKeyword/InitMessUserTable",
                    cutHeight: 5,
                    toolbar: "#exampleToolbar",
                    queryParams: function (params) {
                        params = {
                            //页面大小
                            rows: params.limit,
                            //第几页
                            page: params.offset / params.limit + 1,
                            messType: $('#messType').val(),
                            messNote: $('#messNote').val(),
                            keyword: $('#keyword').val(),
                            messId: $('#messId').val()
                        }
                        return params;
                    },
                    columns: [
                        {
                            field: '', //第一列序号
                            title: '序号',
                            align: 'center',
                            width: 50,
                            formatter: function (value, row, index) {
                                return index + 1;
                            }
                        }, {
                            field: 'mess_id',
                            title: '消息id',
                            align: 'center'
                        }, {
                            field: 'create_date',
                            title: '创建时间',
                            align: 'center'
                        }, {
                            field: 'push_date',
                            title: '推送时间',
                            align: 'center'
                        }, {
                            field: 'push_status',
                            title: '推送状态',
                            align: 'center',
                            formatter: function (value, row, index) {
                                var proType = "";
                                switch (value) {
                                    case 1: proType = "已推送"; break;
                                    default: proType = "未推送"; break;
                                }
                                return proType;
                            }
                        }, {
                            field: 'accept_name',
                            title: '接收人',
                            align: 'center'
                        }, {
                            field: 'accept_phone',
                            title: '接收人手机号',
                            align: 'center'
                        }, {
                            field: 'accept_status',
                            title: '接收状态',
                            align: 'center',
                            formatter: function (value, row, index) {
                                var proType = "";
                                switch (value) {
                                    case 0: proType = "忽略"; break;
                                    case 1: proType = "已读"; break;
                                    default: proType = "未读"; break;
                                }
                                return proType;
                            }
                        }, {
                            field: 'accept_date',
                            title: '接收时间',
                            align: 'center'
                        }, {
                            field: 'mess_type',
                            title: '消息类别',
                            align: 'center',
                            formatter: function (value, row, index) {
                                var proType = "";
                                switch (value) {
                                    case "1": proType = "发展合伙人"; break;
                                    case "2": proType = "新增合伙人"; break;
                                }
                                return proType;
                            }
                        }, {
                            field: 'store_name',
                            title: '店铺名称',
                            align: 'center'
                        }, {
                            field: 'mess_note',
                            title: '消息内容',
                            align: 'center',
                            formatter: function (value, row, index) {
                                if (value && value.length > 20)
                                    return "<span title='" + value + "'>" + value.substring(0, 20) + "...</span>";
                                return value;
                            }
                        }]
                }
                $table = tableHelper.initTable("exampleTableToolbar", options);
            },
            //绑定事件
            bindEvent: function () {
                //查询
                $('#btnSearch').click(function () {
                    $table.bootstrapTable('refresh', options);
                });
            }
        }
        $(function () {
            messUserManager.initPage();
        });
    </script>
}